<?php
/**
 * Description of frofile
 * 
 * @author anhdung
 * @since 02-07-2013 - 09:28:50
 */
?>
<div class="row-fluid">
    <div class="box span12">
        <div class="box-header">
            <h2><i class="icon-user"></i><span class="break"></span><?= Yii::t('user', 'Profile') ?></h2>            
        </div>
        <div class="box-content">
            <?php if (Yii::app()->user->hasFlash('Success_profile')): ?>
                <div class="alert alert-success">
                    <button type="button" class="close" data-dismiss="alert">×</button>
                    <?php echo Yii::app()->user->getFlash('Success_profile'); ?>
                </div>
            <?php endif; ?>
            <?php if (Yii::app()->user->hasFlash('Error_profile')): ?>
                <div class="alert alert-error">
                    <button type="button" class="close" data-dismiss="alert">×</button>
                    <?php echo Yii::app()->user->getFlash('Error_profile'); ?>
                </div>
            <?php endif; ?>
            <?php
            $form = $this->beginWidget('CActiveForm', array(
                'id'                     => 'profile-form',
                'enableAjaxValidation' => true,
//                'enableClientValidation' => true,
                'htmlOptions'            => array(
                    'class'   => 'form-horizontal',
                    'enctype' => 'multipart/form-data',
                ),
                'clientOptions'          => array(
                        'validateOnSubmit' => true,
                    ),
            ));
            ?>
            <fieldset>
                <div class="row-fluid">
                    <div class="span6">
<!--                        <div class="control-group">
                            <?php // echo $form->labelEx($model, 'photo', array('class' => 'control-label')); ?>
                            <div class ="controls">
                                <div class="user_photo">
                                    <img src="<?php // echo $model->publicPhoto ?>" alt="User photo">
                                </div>                                
                                <input type="file" name="file"/>
                            </div>
                        </div>                        -->
                                    <?php
//    $this->widget('ext.ckeditor.CKEditor', array(
//      'model' => $model,
//      'attribute' => 'photo',
//      'editorTemplate' => 'full', // Toolbar settings (full, basic, advanced)
//    ));
    ?>
                        <div class="control-group">
                            <?php echo $form->labelEx($model, 'photo', array('class' => 'control-label')); ?>
                            <div class ="controls">
                                <div class="user_photo">
                                    <img src="<?php echo $model->publicPhoto ?>" alt="User photo" id="prev_photo" height="160" width="160">
                                    <?php echo CHtml::hiddenField('Users[photo]', $model->publicPhoto, array('id'=>"xphoto")); ?>
                                    <?php $this->widget('ext.ckeditor.EImageFinder',array('field'=>'photo','field_name'=>'Users[photo]')); ?>
                                </div>
                            </div>
                        </div>                        
                        <div class="control-group">
                            <?php echo $form->labelEx($model, 'new_pass', array('class' => 'control-label')); ?>
                            <div class ="controls">
                                <?php
                                echo $form->passwordField($model, 'new_pass', array(
                                    'placeholder'  => $model->getAttributeLabel('new_pass'),
                                    'class'        => 'input-file uniform_on input-reset',
                                    'autocomplete' => "off",
                                ));
                                ?>
                                <font color="red"><?php echo $form->error($model, 'new_pass'); ?></font>
                            </div>
                        </div>
                        <div class="control-group">
                            <?php echo $form->labelEx($model, 'repassword', array('class' => 'control-label')); ?>
                            <div class ="controls">
                                <?php
                                echo $form->passwordField($model, 'repassword', array(
                                    'placeholder'  => $model->getAttributeLabel('repassword'),
                                    'class'        => 'input-file uniform_on input-reset',
                                    'autocomplete' => "off",
                                ));
                                ?>
                                <font color="red"><?php echo $form->error($model, 'repassword'); ?></font>
                            </div>
                        </div>
                        <div class="control-group">
                            <?php echo $form->labelEx($model, 'email', array('class' => 'control-label')); ?>
                            <div class ="controls">
                                <?php
                                echo $form->textField($model, 'email', array(
                                    'placeholder' => $model->getAttributeLabel('email'),
                                    'class'       => 'input-file uniform_on input-reset',
                                ));
                                ?>
                                <font color="red"><?php echo $form->error($model, 'email'); ?></font>
                            </div>
                        </div>
                    </div>
                    <?php
                        echo $this->renderPartial('/user/_form_basic', array(
                            'form'      => $form,
                            'model'     => $model,
                            'isProfile' => TRUE,
                        ));
                    ?>
                    <div class="clearfix"></div>
                    <div class="form-actions">
                        <?php echo CHtml::submitButton(Yii::t('user','Save'), array('class' => 'btn btn-primary')); ?>
                        <?php echo CHtml::resetButton(Yii::t('user','Reset'), array('class' => 'btn')); ?>
                    </div>
                </div>
            </fieldset>
            <?php $this->endWidget(); ?>
        </div>
    </div>
</div>
